package net.yuxianghe;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * TestAction
 * Created by hxy on 2017/7/4.
 */
@Controller
public class TestAction {

    @RequestMapping("/")
    @ResponseBody
    public String test(){
        return "hello,world";
    }


     public static String[] mG;


    @Test
    public void test1() {
//        String s = "0ton./1Tdx";
//        String s = "freh";
//        String s = "mScBdId1eg4by76`TeugShBfzo.rNcva2COdfAI`wtMiRgUsYisepuH`Juhsxro_m`karh`l0gGtJSFr}ne`oremihar[o)elavpnyisclut`acslre `allcdlwvt` phnt`moOacienmrtnCop`JehTdmPo`tlsston`epvTls$lt#`_omatSeooaee`___suger@eeaaultv`.hprrtSgetcijeIntmeeb``SOBe`nr`ao``rcttt`p:`oxtcdconriSiene esyaokopppyirdAxAfSOFjrcb.un`emtTdec`iAtaecaeuatl`vd`beg$M`tt`bos`uo`tcilg`fnorCsatCedo`rphl``opli``tsneltNfNizeU liBhScFiutoe`a5`Za_lgrCp0aneafXn7tjoLeba9(P{Gn8tQvFc3dK]V`1xAzi5WFtqEcDlt___`rgmrvtIlec`l_sc_a`sayretcIneo`euwe3ixtysgmbd6aV`_owtCc`latce";
//        String s = "8xS2sdmLA5HCLjWRtC8wZzXETcR6LPiYVnVWgmNgcVVTDV6xedkahllglmnifanuoinjlkcnlamhsijjmlxgkmmjohmfeuxl";
//        String s = "lYemH2a_F1purllkEqTKJYLIVcelcoyFwcqNK6gNAPJ0U6agwsRgcuZFQpT4iVVkErYDDG";
//        String s = "qrcklmDoExthWJiHAp1sVYKU3RFMQw8IGfPO92bvLNj.7zXBaSnu0TC6gy_4Ze5d";
        String s = "qrcklmDoExthWJiHAp1sVYKU3RFMQw8IGfPO92bvLNj.7zXBaSnu0TC6gy_4Ze5d";
        String t = c6(s);
        System.out.println("c6:" + t);
    }

    private String c6(String s) {
        SaicSpiderTest.mG = s.split("");
        String sj[] = sj(mG,0,mG.length,2);
        return StringUtils.join(sj, "");
//        var _$mG=_$mF.split('');
//        _$sj(_$mG,0,_$mG.length,2);
//        var hxy = _$mG;
//        console.log("hxy:"+hxy.join(''));
//        return _$mG.join('');

    }

    private String[] sj(String mF[],double mG,double cL,double a0) {
//        mg, 0,mg.length, 2
//        _$mF,_$mG,_$cL,_$a0
//        var _$kJ=Math.floor((_$mG+_$cL)/2);
//        if(_$a0>0){
//            _$a0-- ;
//            if(_$kJ-_$mG>=3){
//                _$sj(_$mF,_$mG,_$kJ,_$a0);
//            }
//            if(_$cL-_$kJ>=3){
//                _$sj(_$mF,_$kJ,_$cL,_$a0);
//            }
//        }
//        for(var _$i4=_$mG;_$i4<_$kJ;_$i4+=2){
//            var _$cH=_$mF[_$i4];
//            var _$m6=_$cL-1-(_$i4-_$mG);
//            _$mF[_$i4]=_$mF[_$m6];_$mF[_$m6]=_$cH;
//        }
        double kj=Math.floor( (mG+cL)/2 );
        if( a0>0 ){
            a0--;
            if( kj-mG>=3 ){
                sj(mF,mG,kj,a0);
            }
            if( cL-kj>=3 ){
                sj(mF,kj,cL,a0);
            }
        }
        double i4;
        for(i4=mG;i4<kj;i4=i4+2 ){
            String cH = mF[(int) i4];
            double m6 = cL - 1 - (i4 - mG);
            mF[(int) i4]=mF[(int) m6];
            mF[(int) m6]=cH;
        }
        return mF;
    }

}
